import { b2Body } from "@box2d/core";
import { Behaviour } from "./engine/Behaviour";
import { Serialized } from "./engine/Serialized";

export class RigidBody extends Behaviour {

    _x: number = 0;
    _y: number = 0;
    b2body: b2Body;

    @Serialized('textInput')
    sensor: boolean = false;

    @Serialized('numberInput')
    type: number = 0;

    @Serialized('numberInput')
    get x() {
        return this._x;
    }

    set x(value: number) {
        this._x = value;
        this.b2body?.SetTransformXY(this._x, this._y, 0)
    }

    @Serialized('numberInput')
    get y() {
        return this._y;
    }

    set y(value: number) {
        this._y = value;
        this.b2body?.SetTransformXY(this._x, this._y, 0)
    }




}